package org.blueoxygen.kukuruyuk.actions;


import java.util.ArrayList;
import java.util.List;
import org.blueoxygen.cimande.persistence.PersistenceAware;
import org.blueoxygen.cimande.persistence.PersistenceManager;
import org.blueoxygen.cimande.security.SessionCredentials;
import org.blueoxygen.cimande.security.SessionCredentialsAware;
import org.blueoxygen.kukuruyuk.entity.PurchaseOrder;
import com.opensymphony.xwork2.ActionSupport;
public class PurchaseOrderForm extends ActionSupport
implements PersistenceAware, SessionCredentialsAware {
protected PersistenceManager manager;
protected SessionCredentials sessionCredentials;
private PurchaseOrder purchaseOrder = new PurchaseOrder();
private List<PurchaseOrder> purchaseOrders = new ArrayList<PurchaseOrder>();
public String execute(){
if(getPurchaseOrder().getId() != null &&
!"".equalsIgnoreCase(getPurchaseOrder().getId().trim())){
setPurchaseOrder((PurchaseOrder) manager.getById(PurchaseOrder.class, getPurchaseOrder().getId()));
}
return SUCCESS;
}
public void setPersistenceManager(PersistenceManager persistenceManager){
this.manager = persistenceManager;
}
public void setSessionCredentials(SessionCredentials sessionCredentials){
this. sessionCredentials = sessionCredentials;
}
public PurchaseOrder getPurchaseOrder() {
return purchaseOrder;
}
public void setPurchaseOrder(PurchaseOrder purchaseOrder) {
this.purchaseOrder = purchaseOrder;
}
public List<PurchaseOrder> getPurchaseOrders() {
return purchaseOrders;
}
public void setPurchaseOrders(List<PurchaseOrder> purchaseOrders) {
this.purchaseOrders = purchaseOrders;
}
}